<%@ page import="org.jeecgframework.web.util.StaticValue" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div class="easyui-layout" fit="true">
 <div region="center" style="padding:1px;">
  <t:datagrid name="cbsDelinerList" checkbox="true" fitColumns="false" title="发货管理" actionUrl="cbsDelinerController.do?datagridReport"  idField="id" fit="true" queryMode="group" onLoadSuccess="changeColor">
   <t:dgCol title="主键"  field="id"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="发货单号"  field="code"   queryMode="single" query="true"  width="120"></t:dgCol>
   <t:dgCol title="发货状态"  field="status"    queryMode="single"  width="120"   dictionary="<%= StaticValue.Deliver_State %>" query="true"></t:dgCol>
   <t:dgCol title="发货单类型"  field="deliverType"    queryMode="single" query="true" dictionary="<%= StaticValue.Deliver_Type %>" width="120" ></t:dgCol>
   <t:dgCol title="SO"  field="soCode"    queryMode="single"  width="120" query="true"></t:dgCol>
   <t:dgCol title="影院名称"  field="cinemaName"  query="true"  queryMode="single"  width="120" ></t:dgCol>
   <t:dgCol title="省"  field="shengName"  query="true"  queryMode="single"  width="120" ></t:dgCol>
   <t:dgCol title="市"  field="shiName"  query="true"  queryMode="single"  width="120" ></t:dgCol>
   <t:dgCol title="备件申请单号"  field="recordId"    queryMode="single" query="true" width="120"></t:dgCol>
   <t:dgCol title="CR"  field="crCode"    queryMode="single" query="true" width="120" ></t:dgCol>
   <t:dgCol title="SR"  field="srCode"  hidden="true"  queryMode="single"  width="120" ></t:dgCol>
   <t:dgCol title="备件类型"  field="typeDesc"    queryMode="single"  width="120"></t:dgCol>
   <%--<t:dgCol title="备件号"  field="item"    queryMode="single"  width="120"></t:dgCol>--%>
   <t:dgCol title="CSA发货人"  field="CSAName"  query="true" hidden="true" queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="数量"  field="total"    queryMode="single"  width="120"></t:dgCol>
   <%--<t:dgCol title="申请优先级"  field="applyLayer"  dictionary="<%= StaticValue.apply_layer %>"  queryMode="single"  width="120"></t:dgCol>--%>
   <t:dgCol title="发货SLA"  field="fhSLA"    queryMode="single"  query="true" dictionary="<%= StaticValue.Deliver_SLA %>"  width="120" ></t:dgCol>
   <t:dgCol title="物流"  field="deliverLogistics"  query="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="物流承诺SLA"  field="wlSLA"    queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="SLA未达标"  field="isStandard"    queryMode="single" query="true" dictionary="<%= StaticValue.Deliver_Standard %>"  width="120"></t:dgCol>
   <t:dgCol title="ETA延迟"  field="etaStandard"    queryMode="single" query="true" dictionary="<%= StaticValue.ETA_STANDARD %>"  width="120"></t:dgCol>
   <t:dgCol title="签收延迟"  field="signStandard"    queryMode="single" query="true" dictionary="<%= StaticValue.SIGN_STANDARD %>"  width="120"></t:dgCol>
   <t:dgCol title="创单时间"  field="createDate" query="true"  queryMode="group"  width="120" ></t:dgCol>
   <t:dgCol title="CSA发货时间"  field="CSASendTime"   query="true"  queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="物流发货时间"  field="logisticsSendTime"    queryMode="group" query="true"  width="120"></t:dgCol>
   <t:dgCol title="预计到货时间"  field="expectTime"    queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="签收时间"  field="getTime"    queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="物流时长"  field="logisticsDuration"    queryMode="single"  width="120"></t:dgCol>


   <t:dgCol title="创建人名称"  field="createName"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="姓名"  field="userName"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="电话"  field="phone"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="详细地址"  field="address"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="备件序列号SN"  field="sn"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="创建人登录名称"  field="createBy"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="更新人名称"  field="updateName"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="更新人登录名称"  field="updateBy"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="更新日期"  field="updateDate" formatter="yyyy-MM-dd" hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgToolBar title="导出" icon="icon-putout" funname="ExportXls" operationCode="delinerputout"></t:dgToolBar>
  </t:datagrid>
 </div>
</div>
<script src = "webpage/com/zybk/cbs_deliver/cbsDelinerList.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //给时间控件加上样式
        $("#cbsDelinerListtb").find("input[name='createDate_begin']").attr("class","Wdate").attr("style","height:20px;width:90px;").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd'});});
        $("#cbsDelinerListtb").find("input[name='createDate_end']").attr("class","Wdate").attr("style","height:20px;width:90px;").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd'});});
        $("#cbsDelinerListtb").find("input[name='updateDate']").attr("class","Wdate").attr("style","height:20px;width:90px;").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd'});});
        $("#cbsDelinerListtb").find("input[name='CSASendTime_begin']").attr("class","Wdate").attr("style","height:20px;width:90px;").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd'});});
        $("#cbsDelinerListtb").find("input[name='CSASendTime_end']").attr("class","Wdate").attr("style","height:20px;width:90px;").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd'});});
        $("#cbsDelinerListtb").find("input[name='logisticsSendTime_begin']").attr("class","Wdate").attr("style","height:20px;width:90px;").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd'});});
        $("#cbsDelinerListtb").find("input[name='logisticsSendTime_end']").attr("class","Wdate").attr("style","height:20px;width:90px;").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd'});});
    });
    //导出
    function ExportXls() {
        var currPageRows = $("#cbsDelinerList").datagrid("getRows");
        var idsData = [];
        $(currPageRows).each(function (i, rowData) {
            idsData.push(rowData.id);
        });
        if (idsData.length > 0) {
            myDownload("cbsDelinerController.do?exportXls1", "deliverIds=" + idsData.join(","));
        } else {
            tip("当前页面没有数据可以导出");
        }
    }




    /*CSA待发货的文字为红色*/
    function changeColor() {
        var trs = $("#cbsDelinerList").prev().find('div.datagrid-body').find('tr');
        for (var i = 0; i < trs.length; i++) {

            for (var j = 0; j < 20; j++) {
                 if (trs[i].cells[j].firstChild.innerHTML =='CSA待发货' ){
                    trs[i].cells[j].style.cssText = 'color:red';
                }
                if (trs[i].cells[j].firstChild.innerHTML =='Y' ){
                    trs[i].cells[j].style.cssText = 'color:red';
                }
            }
        }
    }
</script>